<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="../templates/template.xhtml">

	<ui:define name="title">
	 	Add Document Package
	</ui:define>

	<ui:param name="page" value="documentPackage" />

	<ui:define name="header">
		<ui:include src="/secure/header.xhtml" />
	</ui:define>

	<ui:define name="menu">
		<div align="center"><h:form id="menuForm">
			<br />
			<br />
			<h:commandButton value="Back" action="#{documentCrud.back}"
				styleClass="buttonClass" />
			<br />
			<br />
		</h:form></div>
	</ui:define>

	<ui:define name="body">
	<f:view>
		<h:form>
			<br />
				Add Document Package
			<br />
			<h:panelGrid columns="2" styleClass="iCubed">
				<f:facet name="header">
					Document Package Information
				</f:facet>
				<h:column> 
					Document Package Name: 
				</h:column>
				<h:column>
					<h:inputText id="dpName" value="#{documentCrud.name}"/>
				</h:column>
			</h:panelGrid>
			<h:panelGrid columns="3">
				<f:facet name="header">
					Documents In The Package
				</f:facet>
				<h:column>
					<h:dataTable value="#{documentCrud.selectOneList}" var="doc">
						<h:column>
							<h:selectOneMenu binding="#{doc}" valueChangeListener="#{documentCrud.documentValueChange}">
								<f:selectItems value="#{documentCrud.documentInstances}" />
							</h:selectOneMenu>
						</h:column>
					</h:dataTable>
				</h:column>
				<h:column>
					<h:dataTable value="#{documentCrud.startPageList}" var="item">
						<h:column id="startPageColumn">
							Start Page:
							<h:inputText binding="#{item}" size="3" valueChangeListener="#{documentCrud.startPageValueChange}"/>
						</h:column>
					</h:dataTable>
				</h:column>
				<h:column>
					<h:dataTable value="#{documentCrud.endPageList}" var="item2">
						<h:column id="endPageColumn">
							End Page:
							<h:inputText binding="#{item2}" size="3" valueChangeListener="#{documentCrud.endPageValueChange}"/>
						</h:column>
					</h:dataTable>
				</h:column>
			</h:panelGrid>
			<br />
			<h:commandButton action="#{documentCrud.addDocument}"
				value="Add More Documents" />
			<h:commandButton action="#{documentCrud.addPackage}"
				value="Add Package"/>
			<h:commandButton action="#{documentCrud.updatePackage}"
				value="Update Package" styleClass="buttonClass"
				rendered="#{documentCrud.uuidExists}" />
			<h:commandButton action="#{documentCrud.deletePackage}"
				value="Delete Package" styleClass="buttonClass"
				rendered="#{documentCrud.uuidExists}" />
		</h:form>
		</f:view>
	</ui:define>

</ui:composition>

</html>
